using System;
using System.Collections.Generic;

public class Category
{
    public int Id { get; set; }
    public string Name { get; set; }
    public List<Category> ChildCatList { get; set; }
}

public class SupplierService
{
    // 模拟从数据库获取一级分类
    private List<Category> getCategory()
    {
        return new List<Category>
        {
            new Category { Id = 1, Name = "实验试剂" },
            new Category { Id = 2, Name = "实验器材" },
            new Category { Id = 3, Name = "实验室耗材" }
        };
    }

    // 模拟从数据库获取二级分类
    private List<Category> getIICategory(int parentId)
    {
        switch (parentId)
        {
            case 1:
                return new List<Category>
                {
                    new Category { Id = 7, Name = "试剂盒" },
                    new Category { Id = 8, Name = "化学试剂" },
                    new Category { Id = 9, Name = "生物试剂" }
                };
            case 2:
                return new List<Category>
                {
                    new Category { Id = 10, Name = "玻璃器皿" },
                    new Category { Id = 11, Name = "塑料器皿" },
                    new Category { Id = 12, Name = "金属器皿" }
                };
            case 3:
                return new List<Category>
                {
                    new Category { Id = 13, Name = "滤纸" },
                    new Category { Id = 14, Name = "手套" },
                    new Category { Id = 15, Name = "防护眼镜" }
                };
            default:
                return new List<Category>();
        }
    }

    public List<Category> GetCategories()
    {
        var categories = getCategory();
        foreach (var category in categories)
        {
            category.ChildCatList = getIICategory(category.Id);
        }
        return categories;
    }
}